home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
c_news
/
16
/
sets
/
setsourc
/
inset.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-03-09
|
664b
|
26 lines
#include <stdio.h>
#include <stdarg.h>
#include "sets.h"
/***************************************************************************/
boolean in_set(set *aset, int entity)
/***************************************************************************/
/* Determines if entity is a member. */
{
int bit,i;
/* check to see if the set has that many words & members */
if(entity > aset->set_size)
return FALSE;
/* get the bit */
bit = entity % MEMBERS_PER_WORD;
/* get the right word */
i = entity / MEMBERS_PER_WORD;
/* detect the bit */
return (aset->word[i] & (1 << bit)) ? TRUE : FALSE;
} /* end in_set */